<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>青鸟影院管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/layui.css" media="all">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/common.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/seat.css">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo"><span>青鸟影院管理系统</span></div>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="updateAdmin.html" >
                   	 <img src="${pageContext.request.contextPath}/img/default.png" class="layui-nav-img layui-anim layui-anim-rotate"/>
                   	 <span id="user_name"></span>
                </a>
            </li>
            <li class="layui-nav-item"><a href="adminNo">退出</a></li>
        </ul>
    </div>
        <div class="layui-side layui-bg-black">
            <div class="layui-side-scroll">
                <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
                <ul class="layui-nav layui-nav-tree" lay-filter="test" id="leftside">
                    <script id="side" type="text/html">
                        {{#  layui.each(d.list, function(index, item){ }}
                        <li class="layui-nav-item">
                            <a href="{{item.url}}"><i class="layui-icon {{item.icon}}"></i> {{item.name}}</a>
                        </li>
                        {{#  }); }}
                        {{#  if(d.list.length === 0){ }}
                        无数据
                        {{#  } }}
                    </script>
                </ul>
            </div>
        </div>
        <div class="layui-body">
            <!-- 主体区域开始 -->
            <!--当前位置开始-->
            <div class="layui-card layadmin-header">
                <span class="layui-breadcrumb">
                      <a href="/">系统</a>
                      <a><cite>座位排表</cite></a>
                </span>
            </div>
            <!--当前位置结束-->

            <div class="layui-row">
                <div id="system" style="height: 245px">
                    
                    <table class="layui-table">
                        <thead>
                            <tr>
                                <td>序号</td>
                                <td>影厅</td>
                                <td>总席位</td>
                                <td>影片</td>
                                <td>价格</td>
                                <td>播放时间</td>
                                <td>操作</td>
                            </tr>
                        </thead>
                        <tbody id="td">
                        <c:forEach items="${schedules}" var="Schedule">
                            <tr>
                                <td>${Schedule.scheduleId}</td>
                                <td>${Schedule.hall.hallName}</td>
                                <td>${Schedule.hall.hallSeats}</td>
                                <td>${Schedule.movie.movieName}</td>
                                <td>${Schedule.moviePrise}</td>
                                <td><fmt:formatDate value="${Schedule.beginDate}" pattern="yyyy-MM-dd"/> ${Schedule.beginHour}：<c:if test="${Schedule.beginMinute<10}">0</c:if>${Schedule.beginMinute}</td>
                                <td>
                                    <a href="deleteSchedule?scheduleId=${Schedule.scheduleId}" class="layui-btn layui-btn-danger layui-btn-xs" rel="1" class="user_del"><i class="layui-icon layui-icon-delete"></i>不再上映</a>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                        <a href="adminSeatAdd" class="layui-btn layui-btn-xs"><i class="layui-icon layui-icon-add-1"></i>添加</a>
                    </table>
                </div>
            </div>
            <!--主体区域结束-->
        </div>
      <div class="layui-footer" style="text-align:center">
        <!-- 底部固定区域 -->
        © 版权管理
    </div>
    </div>
    <script src="${pageContext.request.contextPath}/js/layui.js" charset="utf-8"></script>
    <script src="${pageContext.request.contextPath}/js/jquery-3.3.1.js"></script>
    <script src="${pageContext.request.contextPath}/js/common.js"></script>
    <script src="${pageContext.request.contextPath}/js/jquery.cookie.js"></script>
    <script src="${pageContext.request.contextPath}/js/urlsqit.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.seat-charts.min.js"></script>
    <script src="${pageContext.request.contextPath}/js/seats.js"></script>
    
    <script type="text/javascript">
    
        var str = "";
    
        
        function userlists(arry) {
        	var num = 1;
        	for(var i in arry){
        		str +="<tr>";
        		str +="<td>"+(num++)+"</td>";
        		str +="<td>"+arry[i]["names"]+"</td>";
        		str +="<td>"+arry[i]["sex"]+"</td>";
        		str +="<td>"+arry[i]["iphone"]+"</td>";
        		str +="<td>"+arry[i]["email"]+"</td>";
        		str +="<td><img src='${pageContext.request.contextPath}/img/default.png' class='userhead'></td>";
        		if(arry[i]["states"]=='正常'){
        			str +="<td><span class='layui-badge layui-bg-green'>"+arry[i]["states"]+"</span></td>";
        		}else{
        			str +="<td><span class='layui-badge layui-bg-red'>"+arry[i]["states"]+"</span></td>";
        		}
        		str +="<td> <a href='users_update.html?id="+arry[i]["id"]+"' class='layui-btn layui-btn-xs'><i class='layui-icon layui-icon-edit'></i>修改</a>";
        		str +="<a class='layui-btn layui-btn-danger layui-btn-xs delpuser' rel='"+arry[i]["id"]+"'><i class='layui-icon layui-icon-delete'></i>删除</a>";
        	}
        }
        
        function del_puser() {
            $(".delpuser").click(function(){
            	var ids = $(this).attr("rel");
                layer.open({
                    icon:3,
                    content:"确认删除 ID 为："+$(this).attr("rel")+" 的信息吗？",
                    title:"确认删除",
                    btn: ['确定', '取消'],
                    yes: function(index, layero){
                		$.ajax({
               			 url : "/SSM_CMS/delPUser.do",
               	         type : "post",
               	         data:{
               	        	 "result" : ids,
               	         },
               	         success : function (m) {
               	        	 var arry = JSON.parse(m);
               	        	 console.log(arry);
               	        	 if(arry.state==1){
               	        		layer.msg("删除成功",{
               	                    icon:1,time:2000
               	                });
               	        		 setTimeout("location.href='users.html'",1000);
               	        	 }else{
               	        		 layer.msg('删除失败', {icon: 5,time: 800});
               	        	 }
               	         }
               		});
                        
                    }
                    ,btn2: function(index, layero){
                        layer.msg("已取消",{
                            icon:2,time:1000
                        });
                    }
                });
                return false;
            });
        }
        
    </script>
            
</body>
</html>
